package com.balance.anole.client.retail.dao.hibernate;

import java.util.List;

import org.hibernate.Query;

import com.balance.anole.client.common.dao.hibernate.BaseDAOImpl;
import com.balance.anole.client.retail.dao.DataTransferDAO;
import com.balance.anole.upload.to.DataTransferLogTO;
import com.balance.anole.upload.to.TransferedTableTO;

public class DataTransferDAOImpl extends BaseDAOImpl implements DataTransferDAO {

	@SuppressWarnings("unchecked")
	@Override
	public List<TransferedTableTO> getTablesForTransfer() {
		String hql = "from " + TransferedTableTO.class.getName() + " t order by t.order";
		Query query = getSession().createQuery(hql);
		return query.list();
	}

	@Override
	public void insertOrUpdateTransferLog(DataTransferLogTO log) {
		getHibernateTemplate().saveOrUpdate(log);
	}

	@Override
	public void insertOrUpdateTransferTable(TransferedTableTO table) {
		getHibernateTemplate().saveOrUpdate(table);
	}

}
